package com.example.administrator.ac;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

/**
 * Created by Administrator on 2017/6/27.
 */

public class LoginActivity extends Activity implements OnClickListener{

    EditText password;
    EditText admin;
    Button login;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        init();//初始化组件



    }

    private void init() {
        password=(EditText)findViewById(R.id.password);
        admin=(EditText)findViewById(R.id.admin);
        login=(Button) findViewById(R.id.login);
        login.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        String p=password.getText().toString();
        String a=admin.getText().toString();
        if(p!=null&&a!=null){
            if(p.equals("123")&&a.equals("123")){
                Intent intent=new Intent(LoginActivity.this,MainActivity.class);//登录成功跳转主页面
                startActivity(intent);

        }
    }}
}
